
/*
 These classes 'bind' OpenGL ES to ka API objects. They also provide the backing for a proper EGL implementation.
*/

#ifndef _ka_gles_gles_h
#define _ka_gles_gles_h

#ifndef KA_DISCLUDE_GLES_HEADERS
#   include "GLES/gl.h"
#   include "GLES/glext.h"
#   ifndef KA_GLES_2_NOT_SUPPORTED
#       include "GLES/gl2.h"
#       include "GLES/gl2ext.h"
#   endif
#endif

#include "ka-app/window.h"

namespace ka {
    /**
     * 'EGLConfig-like' attributes (for a suitible EGL implementation)
     */
    struct GLESConfig {
        GLint bufferSize; /*color buffer bits per sample*/
        GLint redSize;
        GLint greenSize;
        GLint blueSize;
        GLint depthSize;
        GLint stencilSize;
        GLint configId;
    };
    
    /**
     * 
     */
    class IGLESDriver {
    public:
        virtual ~IGLESDriver();
        virtual void *createWindowSurface(void *windowHandle, const GLESConfig *config) = 0;
    };
    
    class GLESSurface {
    public:
        enum Type {
            TYPE_NONE,
            TYPE_WINDOW,
            /*TODO: TYPE_PIXMAP ... etc. */
        };
        
    public:
        GLESSurface(IGLESDriver *driver, void *windowHandle, const GLESConfig *config);
    private:
        IGLESDriver *_driver;
        void *_handle;
        Type _type;
    };
    
    class GLESContext {
	public:
	private:
        IGLESDriver *_driver;
        GLESSurface *_drawSurface;
    };
}

#endif